package com.huawei.appgallery.purchasehistory.ui.adapter;

import android.content.Context;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.BaseAdapter;
import android.widget.TextView;
import com.huawei.appgallery.purchasehistory.api.bean.FamilyMemberResponseBean.FamilyMemberResponseInfo;
import com.huawei.appgallery.purchasehistory.ui.protocol.PurchaseHistoryProtocol;
import com.huawei.appgallery.purchasehistory.ui.protocol.PurchaseHistoryProtocol.Request;
import com.huawei.appgallery.purchasehistory.ui.widget.CardRelativeLayout;
import com.huawei.appmarket.framework.widget.uxwidget.roundedimageview.RoundedImageView;
import java.util.List;
import o.azb;
import o.cjk;
import o.cjm;
import o.cjo;
import o.cst.d;
import o.cst.e;
import o.cst.h;
import o.ContentManager;
import o.equ;
import o.evx;

public class FamilyShareMemberAdapter extends BaseAdapter {
    private List<FamilyMemberResponseInfo> familyMemberList;
    private Context mContext;
    private LayoutInflater mInflater;

    static class b {
        TextView ˋ;
        CardRelativeLayout ˎ;
        RoundedImageView ˏ;
        View ॱ;

        b(View view) {
            this.ˋ = (TextView) view.findViewById(e.ˊˊ);
            this.ˏ = (RoundedImageView) view.findViewById(e.ˊᐝ);
            this.ˎ = (CardRelativeLayout) view.findViewById(e.ʼॱ);
            this.ॱ = view.findViewById(e.ʽॱ);
        }
    }

    public FamilyShareMemberAdapter(Context context, List<FamilyMemberResponseInfo> list) {
        this.familyMemberList = list;
        this.mInflater = LayoutInflater.from(context);
        this.mContext = context;
    }

    public int getCount() {
        return this.familyMemberList == null ? 0 : this.familyMemberList.size();
    }

    public FamilyMemberResponseInfo getItem(int i) {
        return (FamilyMemberResponseInfo) this.familyMemberList.get(i);
    }

    public long getItemId(int i) {
        return (long) i;
    }

    public View getView(int i, View view, ViewGroup viewGroup) {
        b bVar;
        if (view == null) {
            view = this.mInflater.inflate(d.ॱॱ, null);
            azb.ˏ(view);
            b bVar2 = new b(view);
            view.setTag(bVar2);
            bVar = bVar2;
        } else {
            bVar = (b) view.getTag();
        }
        final FamilyMemberResponseInfo familyMemberResponseInfo = (FamilyMemberResponseInfo) this.familyMemberList.get(i);
        bVar.ˋ.setText(familyMemberResponseInfo.ˊ());
        bVar.ˏ.setTag(familyMemberResponseInfo.ˎ());
        equ.ˊ(bVar.ˏ, familyMemberResponseInfo.ˎ(), "head_default_icon");
        bVar.ˎ.setOnClickListener(new evx(this) {
            final /* synthetic */ FamilyShareMemberAdapter ˎ;

            public void ˋ(View view) {
                Request request = new Request();
                request.ˊ(ContentManager.getInstant().getContext().getResources().getString(h.ˈ));
                request.ॱ(ContentManager.getInstant().getContext().getResources().getString(h.ʿ));
                request.ˏ(familyMemberResponseInfo.ˊ());
                request.ˋ(familyMemberResponseInfo.ˋ());
                request.ˋ(true);
                cjo purchaseHistoryProtocol = new PurchaseHistoryProtocol();
                purchaseHistoryProtocol.ˊ(request);
                cjk.ˎ().ˋ(this.ˎ.mContext, new cjm("purchasefamilyshare.activity", purchaseHistoryProtocol));
            }
        });
        setDivideLine(i, bVar.ॱ);
        return view;
    }

    private void setDivideLine(int i, View view) {
        if (view != null) {
            if (i == getCount() - 1) {
                view.setVisibility(8);
            } else {
                view.setVisibility(0);
            }
        }
    }
}
